package com.controller;

import com.controller.vo.ResultVO;
import com.dto.LotteryRecordWithPrizeDto;
import com.entity.LotteryOrder;
import com.github.pagehelper.PageInfo;
import com.service.LotteryOrderService;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName LotteryOrderController
 * @Description 奖品订单控制层
 * @Author Kx
 * @Date 2025/6/19 15:58
 * @Version 1.0
 */
@RestController
@RequestMapping("/lotteryOrder")
public class LotteryOrderController extends BaseController {
    private final LotteryOrderService lotteryOrderService;

    public LotteryOrderController(LotteryOrderService lotteryOrderService) {
        this.lotteryOrderService = lotteryOrderService;
    }

    /**
     * @author: kx
     * @date: 2025/6/19 16:00
     * @param lotteryOrder : 奖品订单信息
     * @return com.controller.vo.ResultVO<java.lang.String>
     * @description: 修改奖品订单状态
    */
    @PostMapping("/updateLotteryOrderStatus")
    public ResultVO<String> updateLotteryOrderStatus(@RequestBody LotteryOrder lotteryOrder) {
        lotteryOrderService.updateLotteryOrderStatus(lotteryOrder);
        return success("修改奖品订单状态成功");
    }

    /**
     * @author: kx
     * @date: 2025/6/19 16:21
     * @param pageNum : 页码
     * @param pageSize : 每页显示数量
     * @return com.controller.vo.ResultVO<com.github.pagehelper.PageInfo<com.dto.LotteryRecordWithPrizeDto>>
     * @description:
    */
    @GetMapping("/getPagedLotteryOrders")
    public ResultVO<PageInfo<LotteryRecordWithPrizeDto>> getPagedLotteryOrders(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
        return success(lotteryOrderService.getPagedLotteryOrders(pageNum, pageSize));
    }
}
